package net.hn.hnms.biz.project.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import net.hn.hnms.biz.project.request.ApproveReq;
import net.hn.hnms.biz.project.service.ApproveInfoService;
import net.hn.hnms.biz.project.vo.ApproveInfoVo;
import net.hn.hnms.sys.common.core.domain.R;
import net.hn.hnms.sys.common.mybatis.core.page.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/approve")
@ApiModel("单项工程审批接口")
@Api("单项工程审批")
public class ApproveInfoController {


    @Autowired
    private ApproveInfoService approveInfoService;


    //我的审批列表

    @ApiOperation("我的审批列表")
    @GetMapping("/getApproveInfo")
    public R<Page<ApproveInfoVo>> getApproveInfo(PageQuery page, String username, String standingBookManageId){
        return R.ok(approveInfoService.getApproveInfo(page,username,standingBookManageId));
    }

    //审批
    @ApiOperation("审批")
    @RequestMapping(value = "/approve", method = RequestMethod.POST, produces = "application/json")
    public R approve(@RequestBody ApproveReq req) {
        return R.ok(approveInfoService.approbe(req.getStandingBookManageId(), req.getIsAgree(),req.getOpinion()));
    }


}
